package com.wl.week_01.Homework_01;

/**
 * 测试程序
 * @author TaiZai
 * @data 2024/9/20 18:12
 */
public class Test {
    public static void main(String[] args) {
        // 创建图书馆对象并初始化数据
        Library library = new Library();

        // 创建书籍
        EBook b1 = new EBook("Java", "Author1", 100.00, 12);
        EBook b2 = new EBook("Python", "Author2", 150.00, 26);
        EBook b3 = new EBook("C++", "Author3", 200.00, 33);
        PrintedBook b4 = new PrintedBook("C语言", "Author4", 50.00, 500);
        PrintedBook b5 = new PrintedBook("Go语言", "Author5", 80.00, 120);
        PrintedBook b6 = new PrintedBook("Vue", "Author6", 80.00, 200);

        // 加入图书
        library.addBook(b1);
        library.addBook(b2);
        library.addBook(b3);
        library.addBook(b4);
        library.addBook(b5);
        library.addBook(b6);

        // 展示所有图书
        library.showBooks();

        // 借阅电子书提示无需借阅
        library.rentBook(b1.getTitle());

        // 借阅未借出图书正常
        library.rentBook(b4.getTitle());
        library.showBooks();

        // 借阅已借出图书抛出异常
        // library.rentBook(b4.getTitle());

        // 借书后归还正常
        b4.returnBook();
        library.showBooks();

        // 未借书但是归还抛出异常
        // b4.returnBook();
    }
}
